//import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading

Vue.use(Router)

/* layout */
import Layout from '../views/layout/Layout'

/**
* icon : the icon show in the sidebar
* hidden : if `hidden:true` will not show in the sidebar
* redirect : if `redirect:noredirect` will no redirct in the levelbar
* noDropdown : if `noDropdown:true` will has no submenu
* meta : { role: ['admin'] }  will control the page role
**/
export const constantRouterMap = [
    { path: '/login', component: _import('login/index'), hidden: true },
    { path: '/authredirect', component: _import('login/authredirect'), hidden: true },
    { path: '/404', component: _import('errorPage/404'), hidden: true },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    name: '首页',
    hidden: true,
    children: [{ path: 'home', component: _import('introduction/index') }]
  }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

export const asyncRouterMap = [
  {
    path: '/resource',
    component: Layout,
    redirect: 'noredirect',
    name: '资源管理',
    icon: 'component',
    children: [
      { path: 'priceAudit/index', component: _import('ResourceMNG/priceAudit/index'), name: '价格审核管理'},
      { path: 'hotBrands/index', component: _import('ResourceMNG/hotBrands/index'), name: '热门品牌'},
      { path: 'allCarRources/index', component: _import('ResourceMNG/allCarRources/index'), name: '所有车源'},
        //{ path: 'allCarRources/view', component: _import('ResourceMNG/allCarRources/view'), name: '查看所有车源',hidden:true},
      { path: 'pendAuditCar/index', component: _import('ResourceMNG/pendAuditCar/index'), name: '待审核车源'},
        //{ path: 'pendAuditCar/view', component: _import('ResourceMNG/pendAuditCar/view'), name: '查看车源',hidden:true},
        { path: 'pendAuditCar/edit', component: _import('ResourceMNG/pendAuditCar/edit'), name: '审核车源',hidden:true},
      { path: 'allCarHunt/index', component: _import('ResourceMNG/allCarHunt/index'), name: '所有寻车'},
    ]
  },
  {
    path: '/logistics',
    component: Layout,
    redirect: 'noredirect',
    name: '物流管理',
    icon: 'component',
    children: [
      { path: 'logisticsInfo/index', component: _import('LogisticsMNG/logisticsInfo/index'),  name: '物流信息'},
        //{ path: 'logisticsInfo/view', component: _import('LogisticsMNG/logisticsInfo/view'), name: '查看物流信息',hidden:true},
        { path: 'logisticsInfo/edit', component: _import('LogisticsMNG/logisticsInfo/edit'), name: '编辑物流信息',hidden:true},

      { path: 'addLogisticsInfo/index', component: _import('LogisticsMNG/addLogisticsInfo/index'), name: '添加物流信息'},
        { path: 'addLogisticsInfo/edit', component: _import('LogisticsMNG/addLogisticsInfo/edit'), name: '物流信息添加',hidden:true},

      { path: 'vehicleInfo/index', component: _import('LogisticsMNG/vehicleInfo/index'), name: '验车信息'},
        { path: 'vehicleInfo/edit', component: _import('LogisticsMNG/vehicleInfo/edit'), name: '编辑验车信息',hidden:true},
        //{ path: 'vehicleInfo/view', component: _import('LogisticsMNG/vehicleInfo/view'), name: '查看验车信息',hidden:true},

      { path: 'addVehicleInfo/index', component: _import('LogisticsMNG/addVehicleInfo/index'), name: '添加验车信息'},
        { path: 'addVehicleInfo/edit', component: _import('LogisticsMNG/addVehicleInfo/edit'), name: '验车信息添加',hidden:true},

      { path: 'vehicleFollow/index', component: _import('LogisticsMNG/vehicleFollow/index'), name: '提车跟踪管理'},
        { path: 'vehicleFollow/edit', component: _import('LogisticsMNG/vehicleFollow/edit'), name: '新建提车跟踪管理',hidden:true},
        //{ path: 'vehicleFollow/view', component: _import('LogisticsMNG/vehicleFollow/view'), name: '查看提车跟踪管理',hidden:true},

      { path: 'retirementAudit/index', component: _import('LogisticsMNG/retirementAudit/index'), name: '退单物管待审核'},

      { path: 'frameChange/index', component: _import('LogisticsMNG/frameChange/index'), name: '变更车架号'},
        
    ]
  },
  {
    path: '/mocha',
    component: Layout,
    redirect: 'noredirect',
    name: '运维管理',
    icon: 'component',
    children: [
      { path: 'homeCarousel/index', component: _import('MochaITOMNG/homeCarousel/index'), name: '首页轮播管理'},
        { path: 'homeCarousel/edit', component: _import('MochaITOMNG/homeCarousel/edit'), name: '编辑轮播管理',hidden:true},
      { path: 'hotModels/index', component: _import('MochaITOMNG/hotModels/index'), name: '热门车型管理'},
        { path: 'hotModels/edit', component: _import('MochaITOMNG/hotModels/edit'), name: '编辑热门车型',hidden:true},
      { path: 'hotActivities/index', component: _import('MochaITOMNG/hotActivities/index'), name: '热门活动管理'},
        { path: 'hotActivities/edit', component: _import('MochaITOMNG/hotActivities/edit'), name: '编辑热门活动',hidden:true},
      /*{ path: 'carSourceCarousel/index', component: _import('MochaITOMNG/carSourceCarousel/index'), name: '车源轮播管理'},
        { path: 'carSourceCarousel/edit', component: _import('MochaITOMNG/carSourceCarousel/edit'), name: '编辑车源轮播',hidden:true},*/
      { path: 'activityMessage/index', component: _import('MochaITOMNG/activityMessage/index'), name: '活动简介管理'},
        { path: 'activityMessage/edit', component: _import('MochaITOMNG/activityMessage/edit'), name: '编辑活动简介',hidden:true},
        { path: 'addData/index', component: _import('MochaITOMNG/addData/index'), name: '寻车相关成交'}
    ]
  },
  {
    path: '/risk',
    component: Layout,
    redirect: 'noredirect',
    name: '风控管理',
    icon: 'component',
    children: [
      { path: 'firstTrial/index', component: _import('RiskControlMNG/firstTrial/index'), name: '初审管理'},
        { path: 'firstTrial/edit', component: _import('RiskControlMNG/firstTrial/edit'), name: '编辑初审管理',hidden:true},
      { path: 'secondTrial/index', component: _import('RiskControlMNG/secondTrial/index'), name: '二审管理'},
        { path: 'secondTrial/edit', component: _import('RiskControlMNG/secondTrial/edit'), name: '编辑二审管理',hidden:true},
      { path: 'finalTrial/index', component: _import('RiskControlMNG/finalTrial/index'), name: '终审管理'},
        { path: 'finalTrial/edit', component: _import('RiskControlMNG/finalTrial/edit'), name: '编辑终审管理',hidden:true},
        { path: 'cancelMoney/index', component: _import('RiskControlMNG/cancelMoney/index'), name: '取消垫资'},
      { path: 'contract/index', component: _import('RiskControlMNG/contract/index'), name: '合同管理'},
        { path: 'contract/edit', component: _import('RiskControlMNG/contract/edit'), name: '编辑合同管理',hidden:true},
      { path: 'addContract/index', component: _import('RiskControlMNG/addContract/index'), name: '添加合同管理'},
        { path: 'addContract/edit', component: _import('RiskControlMNG/addContract/edit'), name: '编辑添加合同管理',hidden:true},
      { path: 'backRisk/index', component: _import('RiskControlMNG/backRisk/index'), name: '退单风控待审核'},
        { path: 'backRisk/edit', component: _import('RiskControlMNG/backRisk/edit'), name: '编辑退单风控待管理',hidden:true},
      /*{ path: 'accountChange/index', component: _import('RiskControlMNG/accountChange/index'), name: '收款账号变更管理'},
        { path: 'accountChange/edit', component: _import('RiskControlMNG/accountChange/edit'), name: '编辑收款账号变更管理',hidden:true},
      { path: 'auditRecord/index', component: _import('RiskControlMNG/auditRecord/index'), name: '订单审核记录'},
        { path: 'auditRecord/edit', component: _import('RiskControlMNG/auditRecord/edit'), name: '编辑订单审核记录',hidden:true},
      { path: 'orderSupple/index', component: _import('RiskControlMNG/orderSupple/index'), name: '订单补充资料'},
        { path: 'orderSupple/edit', component: _import('RiskControlMNG/orderSupple/edit'), name: '编辑订单补充资料',hidden:true},*/
      { path: 'capitalOrder/index', component: _import('RiskControlMNG/capitalOrder/index'), name: '资金方订单管理'},
        { path: 'capitalOrder/edit', component: _import('RiskControlMNG/capitalOrder/edit'), name: '编辑资金方订单管理',hidden:true},
      // { path: 'distributorScore/index', component: _import('RiskControlMNG/distributorScore/index'), name: '经销商评分管理'},
        { path: 'distributorScore/edit', component: _import('RiskControlMNG/distributorScore/edit'), name: '编辑经销商评分管理',hidden:true},
      // { path: 'applyLoan/index', component: _import('RiskControlMNG/applyLoan/index'), name: '申请借款单管理'},
        { path: 'applyLoan/edit', component: _import('RiskControlMNG/applyLoan/edit'), name: '编辑申请借款单管理',hidden:true},
    ]
  },
  {
    path: '/finance',
    component: Layout,
    redirect: 'noredirect',
    name: '财务管理',
    icon: 'component',
    children: [
      { path: 'bond/index', component: _import('FinancialMNG/bond/index'), name: '保证金管理'},
        { path: 'bond/edit', component: _import('FinancialMNG/bond/edit'), name: '编辑保证金管理',hidden:true},
      { path: 'confirmedBond/index', component: _import('FinancialMNG/confirmedBond/index'), name: '待确认保证金管理',hidden:true},
        { path: 'confirmedBond/edit', component: _import('FinancialMNG/confirmedBond/edit'), name: '编辑待确认保证金管理',hidden:true},
      { path: 'billMoney/index', component: _import('FinancialMNG/billMoney/index'), name: '打款单管理'},
        { path: 'billMoney/edit', component: _import('FinancialMNG/billMoney/edit'), name: '编辑打款单管理',hidden:true},
      { path: 'payment/index', component: _import('FinancialMNG/payment/index'), name: '回款单管理'},
        { path: 'payment/edit', component: _import('FinancialMNG/payment/edit'), name: '编辑回款单管理',hidden:true},
    ]
  },
  {
    path: '/policy',
    component: Layout,
    redirect: 'noredirect',
    name: '决策管理',
    icon: 'component',
    children: [
      { path: 'orderList/index', component: _import('policyMNG/orderList/index'), name: '订单列表管理'},
        { path: 'orderList/edit', component: _import('policyMNG/orderList/edit'), name: '编辑订单列表管理',hidden:true},
      { path: 'accountsReceivable/index', component: _import('policyMNG/accountsReceivable/index'), name: '应收账款'},
      { path: 'serviceCharge/index', component: _import('policyMNG/serviceCharge/index'), name: '服务费管理'},
      
    ]
  },
  {
    path: '/base',
    component: Layout,
    redirect: 'noredirect',
    name: '基础资料管理',
    icon: 'component',
    children: [
      { path: 'distributor/index', component: _import('BasicDataMNG/distributor/index'), name: '经销商管理'},
        { path: 'distributor/basicDialogForm', component: _import('BasicDataMNG/distributor/basicDialogForm'), name: '编辑经销商基本管理',hidden:true},
        { path: 'distributor/openDialogForm', component: _import('BasicDataMNG/distributor/openDialogForm'), name: '编辑经销商开户管理',hidden:true},
        { path: 'distributor/suppleDialogForm', component: _import('BasicDataMNG/distributor/suppleDialogForm'), name: '编辑经销商补充管理',hidden:true},
      { path: 'ordinary/index', component: _import('BasicDataMNG/ordinary/index'), name: '普通用户管理'},
      { path: 'superiorManage/index', component: _import('BasicDataMNG/SuperiorManage/index'), name: '上游管理'},
        { path: 'ordinary/basicDialogForm', component: _import('BasicDataMNG/ordinary/basicDialogForm'), name: '编辑普通用户基本管理',hidden:true},
        { path: 'ordinary/authDialogForm', component: _import('BasicDataMNG/ordinary/authDialogForm'), name: '编辑普通用户认证管理',hidden:true},
        { path: 'ordinary/suppleDialogForm', component: _import('BasicDataMNG/ordinary/suppleDialogForm'), name: '编辑普通用户补充管理',hidden:true},
      //{ path: 'capital/index', component: _import('BasicDataMNG/capital/index'), name: '资金账户管理'},
      { path: 'logistics/index', component: _import('BasicDataMNG/logistics/index'), name: '物流公司管理'},
      { path: 'borrowingCycle/index', component: _import('BasicDataMNG/borrowingCycle/index'), name: '借款周期管理'},
      { path: 'carFormalities/index', component: _import('BasicDataMNG/carFormalities/index'), name: '汽车手续管理'},
      { path: 'termValidity/index', component: _import('BasicDataMNG/termValidity/index'), name: '有效期管理'},
      { path: 'carSpec/index', component: _import('BasicDataMNG/carSpec/index'), name: '汽车车规管理'},
      { path: 'carBrand/index', component: _import('BasicDataMNG/carBrand/index'), name: '汽车品牌管理'},
      { path: 'carSubBrand/index', component: _import('BasicDataMNG/carSubBrand/index'), name: '汽车子品牌管理'},
      { path: 'carSeries/index', component: _import('BasicDataMNG/carSeries/index'), name: '汽车车系管理'},
      { path: 'carModels/index', component: _import('BasicDataMNG/carModels/index'), name: '汽车车型管理'},
      { path: 'contract/index', component: _import('BasicDataMNG/contract/index'), name: '合同模板管理'},
      // { path: 'gradingStand/index', component: _import('BasicDataMNG/gradingStand/index'), name: '评分标准管理'},
      // { path: 'gradingScore/index', component: _import('BasicDataMNG/gradingScore/index'), name: '评分等级管理'},
    ]
  },
  {
    path: '/system',
    component: Layout,
    redirect: 'noredirect',
    name: '系统管理',
    icon: 'component',
    children: [
      { path: 'menu/index', component: _import('systemMNG/menu/index'), name: '菜单管理'},
      { path: 'role/index', component: _import('systemMNG/role/index'), name: '角色管理'},
      { path: 'user/index', component: _import('systemMNG/user/index'), name: '用户管理'},
      { path: 'password/index', component: _import('systemMNG/password/index'), name: '修改密码管理'},
      { path: 'messageFlow/index', component: _import('systemMNG/messageFlow/index'), name: '消息流程配置'},
      { path: 'onlineusers/index', component: _import('systemMNG/onlineusers/index'), name: '在线人员'},
      { path: 'log/index', component: _import('systemMNG/log/index'), name: '操作日志管理'},
      { path: 'dealerCommunication/index', component: _import('systemMNG/dealerCommunication/index'), name: '通讯录'},
    ]
  },
  /*{
    path: '/order',
    component: Layout,
    redirect: 'noredirect',
    name: '经销商订单管理',
    icon: 'component',
    children: [
      { path: 'orderList/index', component: _import('WebDistributorMNG/order/carOrderList/index'), name: '订单列表'},
      { path: 'orderSupple/index', component: _import('WebDistributorMNG/order/carOrderSupple/index'), name: '订单补充'},
      { path: 'orderBack/index', component: _import('WebDistributorMNG/order/carOrderBack/index'), name: '退单管理'}
      
    ]
  },{
    path: '/logisticsVehicle',
    component: Layout,
    redirect: 'noredirect',
    name: '经销商物流验车管理',
    icon: 'component',
    children: [
      { path: 'logistics/index', component: _import('WebDistributorMNG/logisticsVehicle/logistics/index'), name: '物流管理 '},
      { path: 'vehicle/index', component: _import('WebDistributorMNG/logisticsVehicle/vehicle/index'), name: '验车管理 '}
      
    ]
  },{
    path: '/bond',
    component: Layout,
    redirect: 'noredirect',
    name: '经销商保证金管理',
    icon: 'component',
    children: [
      { path: 'webBond/index', component: _import('WebDistributorMNG/bond/webBond/index'), name: '保证金管理 '},
      { path: 'webBondAdd/index', component: _import('WebDistributorMNG/bond/webBondAdd/index'), name: '待添加保证金管理 '}
      
    ]
  },{
    path: '/contract',
    component: Layout,
    redirect: 'noredirect',
    name: '经销商合同管理',
    icon: 'component',
    children: [
      { path: 'contract/index', component: _import('WebDistributorMNG/contract/index'), name: '合同管理 '}
      
    ]
  },
  */
  // {
  //   path: '/libraryManage',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   name: '库融管理',
  //   icon: 'component',
  //   children: [
  //     { path: 'limitOneManage', component: _import('LibraryManage/LimitOneManage/index'), name: '库融额度管理（初审）'},
  //     { path: 'testCarManage', component: _import('LibraryManage/TestCarManage/index'), name: '库融验车管理'} ,            
  //     { path: 'limiTwoManage', component: _import('LibraryManage/LimitTwoManage/index'), name: '库融额度复审'},
  //     { path: 'riskManage', component: _import('LibraryManage/RiskManage/index'), name: '库融风控管理(二审)'},
  //     { path: 'ReturnList', component: _import('LibraryManage/ReturnList/index'), name: '库融风控退单管理'},
  //     { path: 'addContract', component: _import('LibraryManage/AddContract/index'), name: '添加库融合同'}, 
  //     { path: 'contractManage/index', component: _import('LibraryManage/ContractManage/index'), name: '库融合同管理'}, 
  //     { path: 'loanManage', component: _import('LibraryManage/LoanManage/index'), name: '库融付款单管理'},       
  //     { path: 'paymentManage', component: _import('LibraryManage/PaymentManage/index'), name: '库融回款单管理'},      
  //     { path: 'cashDepositManage', component: _import('LibraryManage/CashDepositManage/index'), name: '库融保证金管理'},       
  //     { path: 'orderList', component: _import('LibraryManage/OrderList/index'), name: '库融订单管理'},              
            
  //   ]
  // },
  { path: '*', redirect: '/404', hidden: true }
]
